import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BizPriceVo } from '@/api/operation/price/types';

/**
 * 查询列表
 * @param query
 * @returns {*}
 */

export const listPrice = (query?: PageQuery): AxiosPromise<BizPriceVo[]> => {
  return request({
    url: '/biz-vendor/price/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询详细
 * @param id
 */
export const getPrice = (id: string | number): AxiosPromise<BizPriceVo> => {
  return request({
    url: '/biz-vendor/price/' + id,
    method: 'get'
  });
};

/**
 * 新增
 * @param data
 */
export const addPrice = (data: BizPriceVo) => {
  return request({
    url: '/biz-vendor/price',
    method: 'post',
    data: data
  });
};

/**
 * 修改
 * @param data
 */
export const updatePrice = (data: BizPriceVo) => {
  return request({
    url: '/biz-vendor/price',
    method: 'put',
    data: data
  });
};

/**
 * 删除
 * @param id
 */
export const delPrice = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-vendor/price/' + id,
    method: 'delete'
  });
};